<?php
	/**
	* Language manager
	* @author tunv
	* @since Apr, 2012
	* @copyright ABSoft Viet Nam
	*/

	if (!defined('EXPONENT')) exit('');
	if (!defined('SYS_CONFIG')) include_once(BASE.'subsystems/config.php');
	require_once(BASE.'subsystems/lang.php');
	require_once(BASE."modules/formhelpermodule/formhelper.php");
	if (exponent_users_isAdmin() ||  exponent_permissions_check(array("administrate"),$loc))
	{   
		$info =array();
		$info = exponent_lang_full() ;

		$formhelper=new formhelper("administrationmodule","_lang_title","_Manager_lang",$loc);
		$formhelper->setGridType(FORMHELPER_GRID_TYPE_DATAGRID);
		$formhelper->setGridOptions("height",300);
		$formhelper->setGridOptions("idField","id");
		$formhelper->setGridOptions("pagination",false);
		$formhelper->setGridOptions("rownumbers",true);
		$formhelper->setGridOptions("singleSelect",true);
		$formhelper->setGridOptions("onDblClickRow","function(____ABSOFT_SetDefault");
		$formhelper->setGridID("lang_grid");
		$js=URL_FULL."modules/administrationmodule/js/LangManager.js";
		$formhelper->addJS($js);
		$formhelper->setColumnType(0);
		//add colum
		$formhelper->addColumn(array("field"=>"name","title"=>"Name",'width'=>100));
		$formhelper->addColumn(array("field"=>"charset","title"=>"Charset",'width'=>60));
		$formhelper->addColumn(array("field"=>"author","title"=>"Author",'width'=>100));
		$formhelper->addColumn(array("field"=>"locale","title"=>"Locale",'width'=>60));
		$formhelper->addColumn(array("field"=>"lang_number","title"=>"Lang number",'width'=>80));
		$formhelper->addColumn(array("field"=>"lang_code","title"=>"Lang Code",'width'=>100));
		//add button
		$formhelper->addToolbarButtons("_Set_Default","add","_ABSOFT_SetDefault()");
		//add data
		foreach ($info as $k=>$v)
			$info[$k]=(object)$v;

		$formhelper->setData($info);
		$formhelper->register_permissions(array('administrate',"configure"),$loc);
		$formhelper->output();
         exponent_sessions_set("AB_THEME_TOP_CONTAINER_SRC","top_systemmodule_".LANG);
    exponent_sessions_set("AB_THEME_TOP_CONTAINER_TYPE","textmodule");
	}
	else
	{
echo exponent_http_error(403);
	}
?>
